import { ListNode } from "./ListNode"

/**
 * 删除排序链表中的重复元素
 * @param head 头节点
 * @returns ListNode | null
 */
function deleteDuplicates(head: ListNode | null): ListNode | null {
  let temp = head
  while (temp && temp.next) {
    if (temp.val === temp.next.val) {
      temp.next = temp.next.next
    } else {
      temp = temp.next
    }
  }
  return head
}